package org.dreamwork.jasmine2.web.controls.pdf;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2010-10-11
 * Time: 15:29:46
 */
public enum MetaElementPosition {
    Top_Left_Corner,    Top_Left,    Top_Center,    Top_Right,    Top_Right_Corner,
    Left_Top,                                                     Right_Top,
    Left_Center,                                                  Right_Center,
    Left_Bottom,                                                  Right_Bottom,
    Bottom_Left_Corner, Bottom_Left, Bottom_Center, Bottom_Right, Bottom_Right_Corner;

    public static MetaElementPosition parse (String text) {
        if (text.indexOf ('_') != -1) text = text.replace ('_', '-');
        for (MetaElementPosition mep : MetaElementPosition.values ()) {
            if (mep.toString ().equalsIgnoreCase (text)) return mep;
        }
        return null;
    }

    @Override
    public String toString () {
        return super.toString ().replace ('_', '-').toLowerCase ();
    }

    public String getClassName () {
        return toString ();
    }

    public String getId () {
        return toString ().replace ('-', '_');
    }
}